package com.xingkeduo.dto;
import com.xingkeduo.pojo.enums.OrderSource;
import com.xingkeduo.pojo.enums.OrderStatus;
import com.xingkeduo.utils.TableAnnotations;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * @author chi  2019-02-15 17:25
 **/
@Data
public class OrderDetailResponseDto {

    private long id;

    private LocalDateTime createdTime;

    @TableAnnotations("用户id")
    @Length(max = 10, message = "length长度在[5,17]之间")
    private String userId;

    @TableAnnotations("对应t_wechat_account表中的id")
    private int wechatId;

    @TableAnnotations("门店id")
    private String storeId;
    @TableAnnotations("门店name")
    private String storeName;

    @TableAnnotations("商品id")
    private int productId;

    @TableAnnotations("手艺人ID")
    private String adminId;

    @TableAnnotations("订单号")
    private String orderNo;

    @TableAnnotations("微信支付第三方唯一标识 out_order_no（如果是支付宝支付的，就代表支付宝的商户订单号；如果是微信支付的，就代表微信的商户订单号）")
    private String outOrderNo;

    @TableAnnotations("代表支付宝交易号")
    private String alipayTradeNo;

    @TableAnnotations("总金额")
    private BigDecimal allPrice;

    @TableAnnotations("使用优惠的金额")
    private BigDecimal couponPrice;

    @TableAnnotations("实际支付的金额")
    private BigDecimal payPrice;


    @TableAnnotations("支付方式")
//    private PayType payType;
    private String payTypeName;

    @TableAnnotations("订单备注")
    private String remark;

    @TableAnnotations("支付时间")
    private LocalDateTime payTime;

    @TableAnnotations("开始服务时间")
    private LocalDateTime serveStartTime;

    @TableAnnotations("结束服务时间")
    private LocalDateTime serveEndTime;

    @TableAnnotations("发型ID")
    private int hairId;

    @TableAnnotations("队列类型1现场队列2预约队列（新逻辑中全部是2，此字段不参与统计）")
    private int mode;

    @TableAnnotations("预约开始时间")
    private LocalDateTime appointmentStartTime;

    @TableAnnotations("预约结束时间")
    private LocalDateTime appointmentEndTime;

    @TableAnnotations("期望等待时间")
    private int expectTime;

    @TableAnnotations("过期时间")
    private int expirationTime;

    @TableAnnotations("")
    private int excel;

    @TableAnnotations("是否有差价 0否 1是")
    private int isDifferencePrice;

    @TableAnnotations("差价金额")
    private BigDecimal differencePrice;

    @TableAnnotations("差价详情")
    private String differencePriceDetail;

    @TableAnnotations("服务类型 1剪发 2刘海 3高级")
    private String serviceTypeId;

    private String serviceTypeName;

    @TableAnnotations("差价商户订单号")
    private String differencePriceOutOrderNo;

    /////////////////////////////
    //需要新加的字段
    @TableAnnotations("是否选择发型师")
    private Boolean chooseAdmin;

    @TableAnnotations("预约发型师id")
    private String appointmentAdminId;
    @TableAnnotations("预约发型师name")
    private String appointmentAdminName;

    @TableAnnotations("支付渠道")
    private String paymentChannels;

    @TableAnnotations("城市id")
    private String cityId;
    @TableAnnotations("城市name")
    private String cityName;

    @TableAnnotations("分公司id")
    private String branchOfficeId;
    @TableAnnotations("分公司name")
    private String branchOfficeName;

    @TableAnnotations("大区id")
    private String vendorId;
    @TableAnnotations("大区name")
    private String vendorName;

    @TableAnnotations("用户手机号")
    private String userMobile;

    @TableAnnotations("用户昵称")
    private String userNickName;

    @TableAnnotations("手艺人名称")
    private String adminName;

    @TableAnnotations("服务完成")
    private Boolean serviceDown;

    @TableAnnotations("排队号")
    private String waitingLineNo;

    @TableAnnotations("退款原因")
    private String refundReason;

    @TableAnnotations("退款方式,如发型师退款")
    private String refundType;

    @TableAnnotations("预约时间只能修改一次")
    private Boolean modifyOnce;

    //预约发型师头像
    private String appointmentAdminAvatar;


    private String statusName;
    private String orderSourceName;
    /**
     * 服务时长
     */
    private String serviceTimeLast;
    private String appointmentTimeShow;
    private String serviceTimeShow;

    /**
     * 评价相关
     */
    private CommentsResponseDto comments;

    //验票码
    private String ticketCode;

    //验票码url
    private String ticketCodeUlr;

    //发型师头像
    private String adminAvatar;

    //已评价
    private Boolean hadComment;

    //验票码过期时间
    private LocalDateTime ticketCodeExpireTime;

    //优惠标识 1优惠券 2会员卡
    private String marketingType;

    //卡券详情
    private String cardCouponDetail;

    //活动类型
    private String activityType;

    //活动详情
    private String activityDetail;

    //活动是否是最优组合
    private String optimal;

    //卡券金额
    private BigDecimal marketingPrice;

    //活动金额
    private BigDecimal activityPrice;

    //活动id
    private String activityId;

    //卡券id
    private String marketingId;

    @TableAnnotations("详见 OrderStatus.class")
    private OrderStatus status;

    private String adminNickName;

    private OrderSource orderSource;

    private String appointmentAdminNickName;


    public void covert(String ticketCodeUlr, String adminAvatar) {
        this.ticketCodeUlr = ticketCodeUlr;
        this.adminAvatar = adminAvatar;

    }
}
